version 12
set more off

*      Nooruddin 'Oil and Debt' 2008 Replication Code

   ****************************************************************
   ***                                                          ***
   ***  This file contains the code to generate all tables in   ***
   ***  Nooruddin, "The Political Economy of National Debt      ***
   ***  Burdens." International Interactions, 34(2): 156-185.   ***
   ***															***
   ****************************************************************


* This file is intended for use with the data file "Nooruddin.II2008.Replication Data.dta".

* OPEN FILE
use "C:\Users\prltemp\Documents\My Dropbox\Research\Debt and Oil\Nooruddin.II2008.Replication Data.dta", clear

******************************************************************************
**************************** BEGIN PRELIMINARIES *****************************
******************************************************************************

*** EXPLORING THE DATA

checksum "C:\Users\prltemp\Documents\My Dropbox\Research\Debt and Oil\Nooruddin.II2008.Replication Data.dta"
* OUTPUT SHOULD READ:
*
* Checksum for C:\Users\prltemp\Documents\My Dropbox\Research\Debt and Oil\Nooruddin.II2008.Replication Data.dta = 3345832795, size = 3473500

set more off
des

* OUTPUT SHOULD READ LIKE THIS (SOME TEXT MAY BE SHIFTED INTO NEXT LINE):
 
/* 

Contains data from C:\Users\prltemp\Documents\My Dropbox\Research\Debt and Oil\Nooruddin.II2008.Re
> plication Data.dta
  obs:         8,707                          
 vars:           278                          15 May 2012 16:44
 size:     3,413,144                          
--------------------------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
--------------------------------------------------------------------------------------------------
ctryid          float  %9.0g                  group(ctrycode)
ctrycode        str7   %9s                    3-letter WB Country Code
ctryname        str33  %33s                   Country Name
year            double %9.0g                  Year
oecd            float  %9.0g                  Dummy region variable for OECD nations, excluding S.
                                                Korea and Mexico
opec            float  %9.0g                  
opec_dza        float  %9.0g                  
debtservice_gni float  %9.0g                  Debt service (as % of GNI)
energy_import~t float  %9.0g                  Net energy imports
gdp_growth      float  %9.0g                  GDP growth (annual %)
polity          float  %9.0g                  PolityIV, combined dem and aut scores -10 to 10,
                                                nonsovereign yrs filled in
trade           float  %9.0g                  Trade (% of GDP)--
oilrents2_gdp   float  %9.0g                  oilrents2/GDPcur
lnoilrents2a    float  %9.0g                  Oil Rents (Ross): ln(oilrents2a+1)
lnoilprod       float  %9.0g                  Log of Crude Oil Production (in 1000 metric tons),
                                                from IEA
reserves_gdp    float  %9.0g                  Changes in net reserves (BoP, % of GDP) =
                                                (reserves/GDPcur)*100
lngdp           float  %9.0g                  Log of GDP (constant 1995 US$)
debt_external~p float  %9.0g                  Augmented External Debt (% of
                                                GDP)=(debt_external1/GDPcur)*100
polity_rescale  float  %9.0g                  Democracy (Polity)
sd_5yr_realdm   float  %9.0g                  Dehn Commodity Price Volatility

*/

*** AND A LOOK AT THE SUMMARY STATS FOR THE SAMPLE ***

tsset ctryid year
xtdes if oecd==0     // ACTUAL NON-OECD SAMPLE

* OUTPUT SHOULD READ:

/*
. tsset ctryid year
       panel variable:  ctryid (unbalanced)
        time variable:  year, 1957 to 2002
                delta:  1 unit

. xtdes if oecd==0     // ACTUAL NON-OECD SAMPLE

  ctryid:  2, 3, ..., 195                                    n =        146
    year:  1970, 1971, ..., 2000                             T =         31
           Delta(year) = 1 unit
           Span(year)  = 31 periods
           (ctryid*year uniquely identifies each observation)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
                        25      31      31        31        31      31      31

     Freq.  Percent    Cum. |  Pattern
 ---------------------------+---------------------------------
      145     99.32   99.32 |  1111111111111111111111111111111
        1      0.68  100.00 |  1111111111111111111111.111.....
 ---------------------------+---------------------------------
      146    100.00         |  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

*/

******************************************************************************
**************************** END OF PRELIMINARIES ****************************
******************************************************************************


more
more

            *****************************************************
            ***  ACTUAL ESTIMATES FOR II TABLES START HERE  ***
            *****************************************************



                         *******************
                         ***   TABLE 1   ***
                         *******************

* MODEL 1:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 2:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 3:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 4:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

                         *******************
                         ***   TABLE 2   ***
                         *******************

* MODEL 1:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale l.polityXlnoilprod l.polityXlnoilprod_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 2:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale l.polityXlnoilrents2a l.polityXlnoilrents2a_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 3:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale l.polityXlnoilprod l.polityXlnoilprod_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 4:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale l.polityXlnoilrents2a l.polityXlnoilrents2a_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

                         *******************
                         ***   TABLE 3   ***
                         *******************

* MODEL 1
xtabond2 debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilprod y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp lnoilprod, lag(0 3))

* MODEL 2
reg debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilprod /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 

* MODEL 3
xtabond2 debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilprod y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp lnoilprod, lag(0 3))

* MODEL 4
reg debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilprod /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 

                         *******************
                         ***   TABLE 4   ***
                         *******************

* MODEL 1 (COLUMN 1, ROW 1)
xtabond2 debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilrents2a y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp lnoilrents2a, lag(0 3))

* MODEL 2 (COLUMN 1, ROW 2)
xtabond2 debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity oilrents2_gdp y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp oilrents2_gdp, lag(0 3))

* MODEL 3 (COLUMN 2, ROW 2)
reg debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilrents2a /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 

* MODEL 4 (COLUMN 2, ROW 2)
reg debt_external1_gdp l.debt_external1_gdp l2.debt_external1_gdp lngdp gdp_growth energy_imports_net reserves_gdp trade polity oilrents2_gdp /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 

* MODEL 5 (COLUMN 3, ROW 1)
xtabond2 debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilrents2a y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp lnoilrents2a, lag(0 3))

* MODEL 6 (COLUMN 3, ROW 2)
xtabond2 debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity oilrents2_gdp y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, robust /*
*/ ivstyle(lngdp trade energy_imports_net polity y1-y43) gmm(l.debt_external1_gdp l2.debt_external1_gdp gdp_growth reserves_gdp oilrents2_gdp, lag(0 3))

* MODEL 7 (COLUMN 4, ROW 2)
reg debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity lnoilrents2a /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 

* MODEL 8 (COLUMN 4, ROW 2)
reg debtservice_gni l.debtservice_gni l2.debtservice_gni lngdp gdp_growth energy_imports_net reserves_gdp trade polity oilrents2_gdp /*
*/ f1-f209 y1-y43 /*
*/ if ctrycode~="OMN"&ctrycode~="NIC"&ctrycode~="COG"&ctrycode~="ZMB"&oecd==0, cluster(ctryid) robust 


                         *******************
                         ***   TABLE 5   ***
                         *******************

* MODEL 1:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net l.sd_5yr_realdm /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale l.polityXlnoilprod l.polityXlnoilprod_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 2:
reg d.debt_external1_gdp ld.debt_external1_gdp l.debt_external1_gdp d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net l.sd_5yr_realdm /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale l.polityXlnoilrents2a l.polityXlnoilrents2a_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 3:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net l.sd_5yr_realdm /*
*/ d.lnoilprod l.lnoilprod /*
*/ l.polity_rescale l.polityXlnoilprod l.polityXlnoilprod_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

* MODEL 4:
reg d.debtservice_gni ld.debtservice_gni l.debtservice_gni d.lngdp l.lngdp d.reserves_gdp l.reserves_gdp /*
*/ d.trade l.trade d.energy_imports_net l.energy_imports_net l.sd_5yr_realdm /*
*/ d.lnoilrents2a l.lnoilrents2a /*
*/ l.polity_rescale l.polityXlnoilrents2a l.polityXlnoilrents2a_ch /*
*/ f1-f209 y1-y43, cluster(ctryid) robust

          **************************************************
          *                    APPENDIX A:                 *
          *                 DESCRIPTIVE STATS              *
          **************************************************

* SUMMARY STATISTICS:
summ 
